package com.kool.evowkf.bean.io.approve;

import com.kool.core.base.BaseBean;
import com.kool.core.exception.AppException;
import com.kool.core.util.StringUtils;
import com.kool.core.validate.IIoValidate;

/**
 * @AUTHOR LUYU
 */
public class CMAGENTXBean extends BaseBean implements IIoValidate {
	protected String nodeCid;
	protected String agentUserCid;
	protected String agentLoginName;

	public String getNodeCid() {
		return nodeCid;
	}

	public void setNodeCid(String nodeCid) {
		this.nodeCid = nodeCid;
	}

	public String getAgentUserCid() {
		return agentUserCid;
	}

	public void setAgentUserCid(String agentUserCid) {
		this.agentUserCid = agentUserCid;
	}

	public String getAgentLoginName() {
		return agentLoginName;
	}

	public void setAgentLoginName(String agentLoginName) {
		this.agentLoginName = agentLoginName;
	}

	@Override
	public void validate() throws AppException {
		// 非空校验
		if (StringUtils.isEmpty(nodeCid)) {
			throw new AppException("SY000036","nodeCid");//字段[%1]为空
		}
		// 最大长度校验
		if (nodeCid != null && nodeCid.length() > 8) {
			throw new AppException("SY000038","nodeCid",String.valueOf(8));//字段[%1]大于最大长度[%2]
		}
		// 非空校验
		if (StringUtils.isEmpty(agentUserCid)) {
			throw new AppException("SY000036","agentUserCid");//字段[%1]为空
		}
		// 最大长度校验
		if (agentUserCid != null && agentUserCid.length() > 8) {
			throw new AppException("SY000038","agentUserCid",String.valueOf(8));//字段[%1]大于最大长度[%2]
		}
		// 非空校验
		if (StringUtils.isEmpty(agentLoginName)) {
			throw new AppException("SY000036","agentLoginName");//字段[%1]为空
		}
		// 最大长度校验
		if (agentLoginName != null && agentLoginName.length() > 60) {
			throw new AppException("SY000038","agentLoginName",String.valueOf(60));//字段[%1]大于最大长度[%2]
		}
	}
}